package com.gxa.saas.portal.mapper;

import com.gxa.saas.core.vo.GoodsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Auther: pengxtao
 * @Date: 2022/7/27下午4:38
 */
@Mapper
public interface GbGoodsMapper {

    @Select("SELECT DISTINCT pr.sales AS sales,pr.pr_id AS prId,pr.pr_price AS prPrice,pr.pr_name AS prName,(SELECT picture.picture_name FROM picture WHERE picture.pro_id = pr.id LIMIT 1 ) AS picture,(SELECT first_classify.first_name AS firstName FROM first_classify,second_classify WHERE second_classify.se_name = (SELECT sc.se_name FROM second_classify sc, product_classify pc WHERE pr.id = pc.product_id AND sc.id = pc.classify_id  LIMIT 1) AND first_classify.id = second_classify.fc_id) AS firstName FROM product pr ,first_classify fc where pr.g_status = 1 AND pr.pr_id=#{id}\n")
    public List<GoodsVo> queryrx(@Param("id") Integer id);
}
